Skip to content

ltc: port AutoRatchet tail-guard boundary KATs from dgb (fill LTC coverage gap) - #701

Merged
frstrtr merged 1 commit into
masterfrom
ltc-doge/ltc-ratchet-desired-version-kats
Jul 14, 2026
Merged

ltc: port AutoRatchet tail-guard boundary KATs from dgb (fill LTC coverage gap)#701
frstrtr merged 1 commit into
masterfrom
ltc-doge/ltc-ratchet-desired-version-kats

Conversation

@frstrtr

@frstrtr frstrtr commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Fills the LTC unit-coverage gap for the AutoRatchet work-weighted 60% tail guard.

LTC already carries the staged-migration integration sim (auto_ratchet_sim_test.cpp) and the desired-version tally KATs (desired_version_tally_test.cpp), but not the focused arithmetic boundary cases the dgb tree has in src/impl/dgb/test/auto_ratchet_tail_guard_test.cpp. This ports those 9 cases, LTC-adapted.

What it pins

LTC has no lifted SSOT header — the tail guard is the inline expression in AutoRatchet::get_share_version (auto_ratchet.hpp:171):

tail_ok = !(tail_target * uint32_t(100) < tail_total * uint32_t(SWITCH_THRESHOLD));

i.e. the EXACT-RATIONAL test target < total*60/100. The KATs pin that LIVE inline form non-circularly, against (a) hand-derived oracle values and (b) an independent local replica of the p2pool canonical FLOOR rule (data.py:1399): SWITCHED iff target >= floor(total*60/100).

The cases (suite LtcAutoRatchetTailGuard, 9 tests)

  • ReduceSplitsAtTargetVersion, EmptyMapIsZeroZero — reduce mirrors the inline accumulation loop (auto_ratchet.hpp:164-169).
  • SwitchedHonoursSixtyPercentFloor, AllOldNeverSwitches, ZeroTotalSwitches — the 60%-by-work gate and its degenerate windows.
  • FloorBoundaryDivergesFromInlineByOneQuantum / ExactFloorAgreesWithInline / LargeWeightsAgreeWithInline — the point of the port: they localise the one-quantum floor divergence (LTC inline is one work-quantum STRICTER at a non-exact floor) and exercise the uint288 multiply/divide path against quantization / overflow bugs.

Scope

Additive, FENCED, ltc-tree-local. Consensus path is NOT modified — pure arithmetic pin of the live inline rule. Joins the share_test executable (already on the build.yml --target allowlist).

Test

100% tests passed, 0 tests failed out of 9

(Linux x86_64, network-free KATs; ctest -R LtcAutoRatchetTailGuard.)

…erage gap)

Adds src/impl/ltc/test/auto_ratchet_tail_guard_test.cpp: 9 focused arithmetic
boundary cases for the work-weighted 60% tail guard, ported from the dgb suite.
LTC has no lifted SSOT header, so the KATs pin the LIVE inline exact-rational
rule (auto_ratchet.hpp:171) non-circularly against hand-derived oracle values
and an independent replica of the p2pool canonical floor rule (data.py:1399).
FloorBoundary/ExactFloor/LargeWeights cases localise the one-quantum floor
divergence and exercise the uint288 multiply/divide path against overflow.
Joins the share_test executable.
@frstrtr

frstrtr commented Jul 14, 2026

Copy link
Copy Markdown
Owner Author

integrator review (verdict, not a gh-approve — single-account fleet blocks self-approve): scope = exactly src/impl/ltc/test/{CMakeLists.txt,auto_ratchet_tail_guard_test.cpp}, pure test-additive single-coin LTC, no source/shared-base touch. 9/9 ctest green, GPG good-sig, non-circular, no overlap with #676. LGTM — cleared for merge on green CI; merge held for operator tap.

@frstrtr
frstrtr merged commit 9aa431f into master Jul 14, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant